package com.m3839.sdk.ym.util

/**
 * Description:用于一些通用的条件判断
 *
 * @author 陈宝阳
 * @create 2019/1/30
 */
object ConditionUtils {
    private const val MIN_CLICK_TIME = 800

    /**
     * 防止短时间内点击两次
     */
    private var lastClickTime: Long = 0

    /**
     * 多次点击检测
     * @return
     */
    @get:Synchronized
    val isFastDoubleClick: Boolean
        get() {
            var result = false
            val currentTime = System.currentTimeMillis()
            if (currentTime - lastClickTime < MIN_CLICK_TIME) {
                result = true
            }
            lastClickTime = currentTime
            return result
        }

    fun resetLastTimeClick() {
        lastClickTime = 0
    }
}